<?php

namespace App\VO\Usercenter\DetailsRewards;

use App\VO\Interfaces\IVODetail;

class VODetail implements IVODetail
{
    public $balance = '';
    public $preBalance = '';
    public $records = [];

    public function __construct($data)
    {
        if ($records = $data['records'] ?? null) {
            foreach ($records as $record) {
                $this->records[] = $record->toArray();
            }
        }
        if ($distributor = $data['distributor'] ?? null) {
            $this->balance = $distributor->getBalance();
            $this->preBalance = $distributor->getPreBalance();
        }
    }
}
